home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
AMUG
/
PROGRAMMING
/
Raven 1.2.sit
/
Raven 1.2
/
Source
/
Foundation
/
OS
/
ZMacDialog.h
< prev
next >
Wrap
Text File
|
1996-11-01
|
3KB
|
96 lines
/*
* File: ZMacDialog.h
* Summary: A class that makes it a bit easier to write toolbox dialog code.
* Written by: Jesse Jones
*
* Copyright ゥ 1996 Jesse Jones.
* For conditions of distribution and use, see copyright notice in ZTypes.h
*
* Change History (most recent first):
*
* <-> 7/17/96 JDJ Created
*/
#pragma once
#include <Dialogs.h>
#include <ZTypes.h>
// ===================================================================================
// TMacDialog
// ===================================================================================
class TMacDialog {
//-----------------------------------
// Initialization/Destruction
//
public:
virtual ~TMacDialog() = 0;
explicit TMacDialog(ResID dlogID);
// Initialize dialog items in your subclasse's ctor.
//-----------------------------------
// External API
//
public:
virtual short Pose();
// Returns the number of the item that dismissed the dialog.
//-----------------------------------
// Frequently Overriden Functions
//
protected:
virtual bool CanDismiss();
// Return true if it's OK to dismiss the dialog. Default
// always returns true.
virtual bool IsDismisser(short item) const;
// Returns true if the dialog item can be used to dismiss the
// dialog. Default returns true if item == ok.
virtual bool IsValidChar(char ch) const;
// Return true if the character is OK. Default always returns
// true. Note that this is not called for action keys.
virtual void OnClickedItem(short& /*item*/) {}
// Called whenever a dialog item is clicked. You can use this to
// maintain state information or handle radio buttons.
//-----------------------------------
// Seldomly Overriden Functions
//
public:
virtual bool HandleEventFilter(EventRecord* event, short* item);
// Called by the dialog's dialog filter. The loop will terminate
// when IsDismisser and CanDismiss return true or when the user
// clicks on the cancel button (item #2).
protected:
virtual short HandleEvents();
// The dialog's event loop.
virtual void Show();
// Called by Pose to display the dialog.
virtual void Hide();
// Called by Pose to hide the dialog.
virtual bool IsValidEvent(const EventRecord& event) const;
virtual bool IsActionChar(char ch) const;
// Returns true if the ch is the Enter, Return, Tab, or Escape key.
virtual bool IsEditChar(char ch, short key) const;
// Returns true if the ch is F2-F4 or an arrow key.
//-----------------------------------
// Member data
//
protected:
DialogPtr mDialog;
};